#!/bin/bash
counter=$(ps -C openresty --no-heading|wc -l)
if [ "${counter}" = "0" ]; then
    sleep 2
    counter=$(ps -C openresty --no-heading|wc -l)
    if [ "${counter}" = "0" ]; then
        systemctl stop keepalived
    fi
fi